home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_pyr1smashout.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  301 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_pyr1smashout.cog
  4. #    
  5. # Blow block out of pyramid 1 with IMP#1
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13. message    startup
  14. message    activated
  15. message    damaged
  16. message    pulse
  17.  
  18. # world things
  19. thing    bigblock        nolink
  20. thing    zookaghost
  21. thing    indyactor        nolink
  22. thing    player            nolink        local
  23. thing    dustthing        nolink        local
  24. thing    blocksnap        nolink
  25.  
  26. # camera things and lookthings
  27. thing    saycam
  28. thing    kaboomcam
  29.  
  30. # hint thing
  31. thing    hint5
  32.  
  33. # templates
  34. template    zooka=+dummy_debris        local
  35. template    dust=dustcloud4ever        local
  36.  
  37. # world surfaces
  38. surface    wall0        mask=0x408
  39. surface    wall1        nolink        
  40. surface    wall2        nolink    
  41. surface    wall3        nolink    
  42. surface    indymark    nolink
  43. surface    nofall        nolink
  44.  
  45. # materials
  46. material    dustmat=gen_a4sfx_dustcloud.mat    local
  47.  
  48. # sectors
  49. sector    hideitall    nolink
  50.  
  51. # sounds
  52. sound    boom=gen_bazooka_fire.wav        local
  53. sound    imp1charge=imp1_chargeup.wav    local
  54. sound    rumble=imp1_wall_break.wav        local
  55.  
  56. # indy saylines
  57. sound    nowwhat=inxj143.wav                local
  58. sound    crumble=inxj025.wav                local
  59. sound    vibrate=inxj026.wav                local
  60.  
  61. # variables
  62. int        i=0            local
  63.  
  64. # subroutines
  65. flex    startscene=0.0    local
  66. flex    endscene=0.0    local
  67. flex    fixcams=0.0        local
  68. flex    fauxdamage=0.0    local
  69. flex    kaboom=0.0        local
  70. flex    indywalk=0.0    local
  71. end
  72.  
  73. code
  74. startup:
  75.     Sleep(.01);
  76.     
  77.     #prepare surfaces
  78.     for (i=0; i < 4; i=i+1)
  79.     {
  80.         # make faces no-move
  81.         ClearAdjoinFlags(GetSurfaceAdjoin(wall0[i]), 2);
  82.         ClearAdjoinFlags(wall0[i], 2);
  83.     
  84.         # make faces no-see, so sector won't be drawn
  85.         ClearAdjoinFlags(wall0[i], 1);
  86.         ClearAdjoinFlags(GetSurfaceAdjoin(wall0[i]), 1);
  87.         
  88.         SetFaceGeoMode(wall0[i], 4);
  89.         SetFaceGeoMode(GetSurfaceAdjoin(wall0[i]), 4);
  90.     }
  91.     
  92.     # reset variable for saylines
  93.     i = 0;
  94.     
  95.     # nofall is the face just next to the block after it tumbles out
  96.     SetAdjoinFlags(nofall, 0x2);
  97.  
  98.     # hideitall is the sector containing the block
  99.     SetSectorAdjoins(hideitall, 0);
  100.  
  101.     return;
  102.  
  103. activated:
  104. # --- > cracked wall
  105.  
  106.     if (GetSenderRef() != wall0) return;
  107.     player = GetLocalPlayerThing();
  108.  
  109.     # if holding IMP1, make it a damage event
  110.     if ((GetCurWeapon(player) == 14) || (InEditor()))
  111.     {
  112.         call fauxdamage;
  113.         return;
  114.     }
  115.  
  116.     # of not holding MP1, do saylines instead
  117.     if (MakeMeStop() == -1) return;
  118.     DeselectWeaponWait(player);
  119.     
  120.     StartCutscene(0);
  121.     
  122.     # interp camera
  123.     SetExtCamOffsetToThing(saycam);
  124.  
  125.     # say line shifts with every activation
  126.     Sleep(0.3);
  127.     if (i == 0)
  128.     {
  129.         PlayVoice(player, vibrate, 1.0, 1);
  130.     }
  131.     else
  132.     {
  133.         PlayVoice(player, crumble, 1.0, 1);
  134.     }
  135.  
  136.     i = 1 - i;
  137.  
  138.     # restore controls and camera
  139.     RestoreExtCam();
  140.     EndCutscene();
  141.     ClearActorFlags(player, 0x200000);
  142.  
  143.     return;
  144.  
  145. damaged:
  146. # ---> cracked wall
  147.     
  148.     #if damage wasn't caused by MP1, return
  149.     if (GetParam(1) != 0x1000) return;
  150.  
  151. fauxdamage:
  152. # ---> shortcut to get around "activation with IMP#1"
  153.     
  154.     player = GetLocalPlayerThing();
  155.  
  156.     if (MakeMeStop() == -1) return;
  157.  
  158.     # give Urgon's part a chance to open up and close again
  159.     Sleep(.35);
  160.     
  161.     call startscene;
  162.     call kaboom;
  163.     call indywalk;
  164.     return;
  165.  
  166. startscene:
  167.     # prepare camera and player
  168.     call fixcams;    
  169.  
  170.     StartCutscene(1);
  171.     
  172.     # change to outside camera
  173.     SetCameraFocus(2, kaboomcam);
  174.     SetCameraSecondaryFocus(2, indyactor);
  175.     SetCurrentCamera(2);
  176.     ResetCameraFOV(0, 0);
  177.     
  178.     ResetThing(player);
  179.     TeleportThing(indyactor, player);
  180.     CopyPlayerHolsters(player, indyactor);
  181.     SetThingFlags(player, 0x80000);
  182.     ClearThingFlags(indyactor, 0x80000);
  183.  
  184.     return;
  185.         
  186. kaboom:
  187.     # make adjoin see-through beforehand
  188.     SetSectorAdjoins(hideitall, 1);
  189.  
  190.     # remove collision from big block
  191.     SetCollideType(bigblock, 0);
  192.  
  193.     # start camerashake
  194.     SetPulse(0.05);
  195.     
  196.     # play chargeup effect
  197.     PlaySoundThing(imp1charge, indyactor, 1.0, 10.0, 20.0, 0);
  198.     Sleep(1.5);
  199.     
  200.     # play crackling effect
  201.     PlaySoundThing(rumble, indyactor, 1.0, 10.0, 20.0, 0);
  202.     Sleep(1);
  203.  
  204.     # pause for drama, then boom
  205.     PlaySoundThing(boom, bigblock, 1.0, 10.0, 20.0, 0);
  206.     CreateThing(zooka, zookaghost);
  207.  
  208.     # clear surfaces
  209.     for (i=0; i < 4; i=i+1)
  210.     {
  211.         # make all adjoins move-through
  212.         SetAdjoinFlags(wall0[i], 2);
  213.         SetAdjoinFlags(GetSurfaceAdjoin(wall0[i]), 2);
  214.         
  215.         # make all adjoins see-through
  216.         SetAdjoinFlags(wall0[i], 1);
  217.         SetAdjoinFlags(GetSurfaceAdjoin(wall0[i]), 1);
  218.     
  219.         # turn off face visibility
  220.         SetFaceGeoMode(wall0[i], 0);
  221.         SetFaceGeoMode(GetSurfaceAdjoin(wall0[i]), 0);
  222.     }
  223.  
  224.     # shove block out
  225.     MoveToFrame(bigblock, 2, 10);
  226.  
  227.     # stop the madness
  228.     SetPulse(0);
  229.  
  230.     # create and animate the dust sprites
  231.     SetMaterialCel(dustmat, 0);
  232.     MaterialAnim(dustmat, 1.0, 1);
  233.     dustthing = CreateThing(dust, zookaghost);
  234.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  235.     sleep(.3);
  236.     dustthing = CreateThing(dust, indyactor);
  237.     AnimateSpriteSize(dustthing, '0.2 0.2 0.5', '0.6 0.6 0.0', 4.0);
  238.     
  239.     # take care of hints
  240.     SetHintSolved(hint5);
  241.  
  242.     return;
  243.  
  244. indywalk:
  245.     # make indy walk forward while camera swings inward
  246.     MoveToFrame(kaboomcam, 1, 1);
  247.     sleep(1);
  248.  
  249.     # Indywalks forward, looks at block
  250.     AISetMovePos(indyactor, GetSurfaceCenter(indymark), 0);
  251.     AISetLookThing(indyactor, bigblock);
  252.     AIWaitForStop(indyactor);
  253.  
  254.     # Indy: Now What?
  255.     PlayVoice(indyactor, nowwhat, 1, 1);
  256.     sleep(1);
  257.  
  258.     # snap block to perfect position for pushing
  259.     TeleportThing(bigblock, blocksnap);
  260.     
  261.     # restore collision to big block
  262.     SetCollideType(bigblock, 3);
  263.  
  264.        # keep player from falling through adjoin next to box
  265.     ClearAdjoinFlags(nofall, 0x2);
  266.  
  267.     call endscene;
  268.     return;
  269.  
  270. endscene:
  271.     # put player in place, end the cutscene
  272.     TeleportThing(player, indyactor);
  273.     SetThingFlags(indyactor, 0x80000);
  274.     ClearThingFlags(player, 0x80000);
  275.     SetCurrentCamera(1);
  276.  
  277.     DeselectWeaponWait(player);
  278.     ClearActorFlags(player, 0x200000);
  279.     
  280.     call fixcams;
  281.  
  282.     EndCutscene();
  283.     return;
  284.  
  285. fixcams:
  286.     #reset camera settings
  287.     ResetCameraFOV(0, 0);
  288.     SetCameraPosInterp(2, 0);
  289.     SetCameraLookInterp(2, 0);
  290.     SetCameraPosInterp(1, 0);
  291.     SetCameraLookInterp(1, 0);
  292.     RestoreExtCam();
  293.     return;
  294.  
  295. pulse:
  296.     SetPOVShake('0.0 0.0 0.005', '0.0 0.0 0.1', 80.0, 0.80);
  297.  
  298.     return;
  299.     
  300. end
  301.